package com.erlang.springbootcondition.config;

import com.erlang.springbootcondition.condition.ConditionOnClass;
import com.erlang.springbootcondition.entity.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by IntelliJ IDEA.
 *
 * @author ZGQ
 */
@Configuration
public class UserConfig {

    @Bean
    //@Conditional(ClassCondition.class)
    @ConditionOnClass("com.alibaba.fastjson.JSON")
    public User user(){
        return new User();
    }

    @Bean
    @ConditionalOnProperty(name = "name",havingValue = "erlang")
    public User user2(){
        return new User();
    }
}
